package com.jiulan.hearthearing.ui.course.adapter;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jiulan.hearthearing.R;
import com.jiulan.hearthearing.ui.course.model.CourseNewModel;
import com.shehuan.niv.NiceImageView;

import java.util.List;

public class CourseNewAdapter extends BaseQuickAdapter<CourseNewModel.DataBean, BaseViewHolder> {

    public CourseNewAdapter(List<CourseNewModel.DataBean> data) {
        super(R.layout.item_heart_course, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CourseNewModel.DataBean item) {
        NiceImageView nivPic = helper.getView(R.id.nivPic);
        Glide.with(mContext).load(item.getMain_image()).apply(new RequestOptions().transform(new CenterCrop(), new RoundedCorners(10))).into(nivPic);
        helper.setText(R.id.tvTitle, item.getTitle());
        helper.setText(R.id.tvContent, item.getShort_title());
//        helper.setText(R.id.tvAuthor, item.getLecturer().getName() + "·" + item.getLecturer().getTitle());
        helper.addOnClickListener(R.id.tvCheck);
    }
}
